<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // let student={};
        // student.name="蔡徐坤";
        // student.height=175;
        // student.dance=function(){
        //     console.log("唱调rap");
        // }
        // console.log(student);
        // student.dance();

        // let student=new Object();

        // let student = {
        //     name: "蔡徐坤",
        //     height: 175,
        //     dance: function () {
        //         console.log("唱调rap");
        //     },
        // }
        // // student.dance();
        // console.log(student.name);
        // console.log(student["name"]);
        // student.dance();
        // student["dance"]();

        //构造方法
        function Cat(name, age, sound) {
            this.name = name;
            this.age = age;
            this.sound = function () {
                console.log(sound);
            }
        }
        let cat1 = new Cat("kk", 12, "喵");
        console.log(cat1);
        cat1.sound();

        let cat2 = new Cat("yy", 1, "喜");
        console.log(cat2);
        cat2.sound();


    </script>
</body>

</html>